package com.qining618.cms.cms.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qining618.cms.cms.domain.Content;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.Map;

/**
 * <p>
 * CMS内容 Mapper 接口
 * </p>
 *
 * @author qining
 * @date 2019-09-17
 */
@Mapper
@Repository
public interface ContentMapper extends BaseMapper<Content> {

    /**
     * 分页查询
     * @param page 分页信息
     * @param params 参数
     * @return IPage&lt;Content&gt;
     */
    IPage<Content> page(Page<Content> page, @Param("map") Map<String, Object> params);

    /**
     * 置顶id内容是都存在
     * @param id 内容id
     * @return boolean
     */
    @Select("select count(1) from c_content where id = #{id}")
    boolean existById(@Param("id") Long id);
}